<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ajax</title>
</head>
<body>

</body>
<script>
   /* $.ajax({
        url: op.url || "",
        method: op.method || "",
        type: op.type || "",
        success: op.success || function () {

        },
        data
    });
*/

/*    $.ajax = function (op) {
        let obj = {
            url: op.url || "",
            method: op.method || "",
            type: op.type || "",
            success: op.success || function () {

            },
            data: op.data || null
        };
        var xhr = new XMLHttpRequest();
        xhr.open(obj.method, obj.url, true);//sync
        xhr.send('user=tom&age=10&sex=女');
        xhr.onreadystatechange = function () {//监听函数
            if (xhr.readyState === 4 && xhr.status === 200) {
                console.log(xhr.responseText);
                var res=JSON.parse(xhr.responseText);
//                console.log(res);
                obj.success && obj.success(res)
            }
        };
    };*/



    console.log(window.navigator.userAgent);//判断浏览器版本/内核...
    var xhr = new XMLHttpRequest();
    xhr.open('get', 'http://47.115.85.237:3000/resources/carousel', true);//sync
    xhr.send('user=tom&age=10&sex=女');
    xhr.onreadystatechange=function(){//监听函数
        if(xhr.readyState===4 && xhr.status===200){
                console.log(xhr.responseText);
//                var res=JSON.parse(xhr.responseText);
//                console.log(res);
        }
    };

//    console.log(xhr);//判断浏览器版本/内核...


    /*function ajax(url) {

    }*/

</script>
</html>